﻿
/*
 * This file is part of SCWS.
 * SCWS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 * 
 * Foobar is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with SCWS.  If not, see <http://www.gnu.org/licenses/>.
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Data;
using System.Windows;
using System.Windows.Media.Animation;
using System.Management;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace ScwsClient.Common
{
    public class WebServices
    {

        public string rms, comment, subject, reason, classname, id;

        public int minutes;


        private static ScwsWpfClient.scws.Om getWebService()
        {
            ScwsWpfClient.scws.Om Omws = new ScwsWpfClient.scws.Om();

            Omws.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

            return Omws;
        }



        public DataTable GetMonitoringObjectInfo()
        {
            DataTable dt = getWebService().GetMonitoringObjectInfo(rms, id).Tables[0];
            return dt;
        }



        public DataTable QueryMonitoringObjectsByClassName()
        {
            DataTable dt = getWebService().QueryMonitoringObjectsByClassName(rms, subject, classname).Tables[0];
            return dt;
        }



        public string GetMonitoringObjectId()
        {
            string id = getWebService().GetMonitoringObjectId(rms, subject, classname);
            return id;
        }



        public DataTable MMStartByWindowsComputerName()
        {
            DataTable dt = getWebService().MMStartByWindowsComputerName(subject,
                                        rms,
                                        minutes,
                                        reason,
                                        comment).Tables[0];
            return dt;
        }



        public DataTable MMStopByWindowsComputerName()
        {
            DataTable dt = getWebService().MMStopByWindowsComputerName(subject, rms).Tables[0];
            return dt;
        }



        public DataTable MMStartByGroupName()
        {
            DataTable dt = getWebService().MMStartByGroupName(subject,
                                        rms,
                                        minutes,
                                        reason,
                                        comment).Tables[0];
            return dt;
        }



        public DataTable MMStopByGroupName()
        {
            DataTable dt = getWebService().MMStopByGroupName(subject,
                                        rms).Tables[0];
            return dt;
        }

    }
        
}
